﻿CREATE TRIGGER [dbo].[triu_State_Group_Access]
ON [dbo].[t_State_Group_Access]
FOR INSERT,UPDATE
AS

IF NOT UPDATE(principal_id) RETURN

EXEC admin.sec_CheckStateEditAccess

UPDATE    t_State_Group_Access
SET              principal_name = P.NameSpace
FROM         t_State_Group_Access AS i INNER JOIN
                      dbo.fs_Principals() AS P ON i.principal_id = P.principal_id INNER JOIN
                      t_State_Group_Access ON i.ID = t_State_Group_Access.ID

